import React, { Component } from 'react'
import { HashRouter as Router, Route, Redirect, Switch } from "react-router-dom"
import TabBar from "./component/tabBar/TabBar"
import Home from "./component/home/Home"
import Category from "./component/category/Category"
import Cart from "./component/cart/Cart"
import My from "./component/my/My"
import SearchPage from "./component/searchPage/searchPage"
import GoodDetail from "./component/goodDetail/goodDetail"
import GoodList from "./component/goodList/goodList"

export default class RouterConfig extends Component {
  render() {
    return (
      <div>
        <Router>
          <Switch>
            <Route exact path="/" render={() => <TabBar><Home></Home></TabBar>}></Route>
            <Route exact path="/category" render={() => <TabBar><Category></Category></TabBar>}></Route>
            <Route exact path="/cart" render={() => <TabBar><Cart></Cart></TabBar>}></Route>
            <Route exact path="/my" render={() => <TabBar><My></My></TabBar>}></Route>
            <Route exact path="/searchPage" render={() => <SearchPage></SearchPage>}></Route>
            <Route exact path="/goodDetail/:goods_id" render={(props) => <GoodDetail {...props}></GoodDetail>}></Route>
            <Route exact path="/goodList/:query" render={(props) => <GoodList {...props}></GoodList>}></Route>
            <Redirect to="/" ></Redirect>
          </Switch>
        </Router>
      </div>
    )
  }
}